var a = require("../../@babel/runtime/helpers/defineProperty"),
  t = require("../../res/www.a9a.cn.js"),
  e = getApp(),
  n = 2,
  o = !0,
  i = wx.getStorageSync("COOK_U");
Page({
  data: {
    topbar: ["我喜欢", "喜欢我"],
    currentTab: 0,
    loading_flag: !1,
    loading_ico_flag: !1,
    loading_str: "拼命加载中",
  },
  topbarFn: function (a) {
    var t = parseInt(a.currentTarget.dataset.idx);
    this.setData({ currentTab: t }), this.get_data(t + 1);
  },
  onLoad: function (a) {
    var i = this;
    e.get_config("_ZEAI").then(function (e) {
      i.setData({ color: e.color, rgbcolor: t.c16_rgb(e.color) }),
        (n = 2),
        (o = !0),
        i.get_data(a.t);
    });
  },
  get_data: function (t) {
    var n = this;
    t = parseInt(t);
    e.chklogin().then(function (a) {
      a || wx.navigateBack();
    }),
      (o = !1),
      (i = wx.getStorageSync("COOK_U")),
      e.ajax({
        url: "my_follow.php",
        data: { submitok: "list", t: t, openid: i.openid },
        success: function (e) {
          switch (t) {
            case 1:
              var i = e.LIST1;
              break;
            case 2:
              i = e.LIST2;
          }
          if (1 == e.flag) {
            var s;
            if (
              (i.length >= 15 &&
                n.setData({ loading_flag: !0, loading_ico_flag: !0 }),
              0 == i.length)
            )
              n.setData(a({ loading_flag: !1 }, "nodatabox" + t, !0));
            else
              n.setData(
                (a((s = {}), "LIST" + t + "[0]", i),
                a(s, "nodatabox" + t, !1),
                a(s, "loading_flag", !1),
                s)
              );
            o = !0;
          } else
            wx.showModal({
              content: e.msg,
              confirmColor: n.data.color,
              confirmText: "朕知道了",
              showCancel: !1,
              success: function (a) {
                wx.navigateBack();
              },
            });
        },
      });
  },
  onReachBottom: function () {
    var t = this,
      i = parseInt(this.data.currentTab) + 1;
    switch (i) {
      case 1:
        var s = this.data.LIST1;
        break;
      case 2:
        s = this.data.LIST2;
    }
    var r = wx.getStorageSync("COOK_U");
    o &&
      ((o = !1),
      t.setData({ loading_ico_flag: !0 }),
      e.ajax({
        url: "my_follow.php",
        data: { submitok: "list", t: i, p: n, openid: r.openid },
        success: function (e) {
          switch (i) {
            case 1:
              var r = e.LIST1;
              break;
            case 2:
              r = e.LIST2;
          }
          if (r.length < 1)
            return (
              t.setData({
                loading_flag: !0,
                loading_ico_flag: !1,
                loading_str: "已全部加载完成",
              }),
              void (o = !1)
            );
          t.setData(a({}, "LIST" + i + "[" + s.length + "]", r)),
            (n += 1),
            (o = !0);
        },
      }));
  },
  uidFn: function (a) {
    var t = a.currentTarget.dataset.uid;
    wx.navigateTo({ url: "../u/u?uid=" + t });
  },
  gzdelFn: function (t) {
    var n = this;
    wx.showModal({
      content: "取消关注后，你将无法接收Ta的动态哦",
      confirmColor: n.data.color,
      cancelText: "我再想想",
      confirmText: "取消关注",
      success: function (o) {
        if (o.confirm) {
          var s = t.currentTarget.dataset.id,
            r = t.currentTarget.dataset.idx_list,
            c = t.currentTarget.dataset.idx_dl;
          e.ajax({
            url: "my_follow.php",
            data: { submitok: "follow_del", id: s, openid: i.openid },
            success: function (t) {
              1 == t.flag
                ? n.setData(a({}, "LIST1[" + r + "][" + c + "]", null))
                : wx.showToast({ title: t.msg, icon: "none", mask: !0 });
            },
          });
        }
      },
    });
  },
  gzdelFn2: function (t) {
    var n = this,
      o = t.currentTarget.dataset.uid,
      s = t.currentTarget.dataset.idx_list,
      r = t.currentTarget.dataset.idx_dl;
    "addgz" == t.currentTarget.dataset.cls
      ? e.ajax({
          url: "my_follow.php",
          data: { submitok: "ajax_fans_gz", uid: o, openid: i.openid },
          success: function (t) {
            var e;
            1 == t.flag
              ? n.setData(
                  (a((e = {}), "LIST2[" + s + "][" + r + "].btn.class", "ed"),
                  a(e, "LIST2[" + s + "][" + r + "].btn.title", "互相关注"),
                  e)
                )
              : wx.showToast({ title: t.msg, icon: "none", mask: !0 });
          },
        })
      : wx.showModal({
          content: "取消关注后，你将无法接收Ta的动态哦",
          confirmColor: n.data.color,
          cancelText: "我再想想",
          confirmText: "取消关注",
          success: function (t) {
            t.confirm &&
              e.ajax({
                url: "my_follow.php",
                data: { submitok: "ajax_fans_del", uid: o, openid: i.openid },
                success: function (t) {
                  var e;
                  1 == t.flag
                    ? n.setData(
                        (a(
                          (e = {}),
                          "LIST2[" + s + "][" + r + "].btn.class",
                          "addgz"
                        ),
                        a(e, "LIST2[" + s + "][" + r + "].btn.title", "关注"),
                        e)
                      )
                    : wx.showToast({ title: t.msg, icon: "none", mask: !0 });
                },
              });
          },
        });
  },
});
